package bb.lanxing.util.ui;

import android.app.Activity;
import android.content.Intent;
import android.graphics.drawable.Drawable;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.fragment.app.Fragment;
import androidx.vectordrawable.graphics.drawable.VectorDrawableCompat;

import kotlin.jvm.internal.Intrinsics;

public final class TypeExtensionsKt {
    public static final void startActivity(Fragment fragment, Class<?> cls) {
        Intrinsics.checkNotNullParameter(fragment, "<this>");
        Intrinsics.checkNotNullParameter(cls, "cls");
        fragment.startActivity(new Intent(fragment.getContext(), cls));
    }

    public static final View inflate(ViewGroup viewGroup, int i, boolean z) {
        Intrinsics.checkNotNullParameter(viewGroup, "<this>");
        View inflate = LayoutInflater.from(viewGroup.getContext()).inflate(i, viewGroup, z);
        Intrinsics.checkNotNullExpressionValue(inflate, "from(context).inflate(layout, this, attachToRoot)");
        return inflate;
    }

    public static final void setDrawableLeft(TextView textView, int i, Activity activity) {
        Intrinsics.checkNotNullParameter(textView, "<this>");
        Intrinsics.checkNotNullParameter(activity, "activity");
        textView.setCompoundDrawablesWithIntrinsicBounds(VectorDrawableCompat.create(textView.getResources(), i, activity.getTheme()), (Drawable) null, (Drawable) null, (Drawable) null);
    }

    public static final float sqrt(float f) {
        return (float) Math.sqrt(f);
    }

    public static final CharSequence getText(View view, int i) {
        Intrinsics.checkNotNullParameter(view, "<this>");
        CharSequence text = view.getResources().getText(i);
        Intrinsics.checkNotNullExpressionValue(text, "this.resources.getText(res)");
        return text;
    }
}